<template>
    <div class="vehicle-info">
      <h2>车辆详情</h2>
      <div class="vehicle-details">
        <div class="detail-item" v-for="(value, key, index) in vehicleDetails" :key="index">
          <span class="label">{{ key }}</span>
          <span class="value">{{ value }}</span>
        </div>
      </div>
      <div class="charge-records">
        <h3>充电记录</h3>
        <table>
          <thead>
            <tr>
              <th style="background-color: white;color: black;" >充电日期</th>
              <th style="background-color: white;color: black;">充电开始时间</th>
              <th style="background-color: white;color: black;">充电电量</th>
              <th style="background-color: white;color: black;">充电完成电量</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="record in chargeRecords" :key="record.date">
              <td>{{ record.date }}</td>
              <td>{{ record.startTime }}</td>
              <td>{{ record.startCharge }}</td>
              <td>{{ record.endCharge }}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </template>
  
  <script setup>
  import { reactive } from 'vue'
  
  const vehicleDetails = reactive({
    vehicleId: 'CL-888',
    licensePlate: '鄂A1234',
    activationDate: '2017-01-06',
    status: '使用中',
    company: '金鼎天创公交集团'
  })
  
  const chargeRecords = reactive([
    { date: '2021-02-05', startTime: '21:05', startCharge: '75%', endCharge: '98%' },
    { date: '2021-02-08', startTime: '14:01', startCharge: '23%', endCharge: '89%' },
    // ...其他充电记录
  ])
  </script>
  
  <style scoped>
  .vehicle-info {
    padding: 20px;
    background-color:rgba(red, green, blue, alpha); /* 设置背景颜色 */
  }
  
  .vehicle-details {
    display: flex;
    flex-wrap: wrap;
  }
  
  .detail-item {
    flex: 0 1 30%;
    margin: 10px;
    padding: 10px;
    background-color: '#f0f0f';
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .label {
    color: #888;
    font-size: 14px;
    margin: 10px;
  }
  
  .value {
    color: #333;
    font-size: 16px;
  }
  
  .charge-records {
    margin-top: 20px;
  }
  
  table {
    width: 100%;
    border-collapse: collapse;
  }
  
  th, td {
    padding: 8px;
    text-align: center;
    border: 1px solid #ddd;
  }
  </style>